package org.linlinjava.litemall.db.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.linlinjava.litemall.db.models.Coupon;

import java.util.List;

public interface CouponService extends IService<Coupon> {

    public IPage<Coupon> queryAvailableList(Integer userId, int offset, int limit) ;

    public IPage<Coupon> queryList(int offset, int limit) ;

    public Coupon findByCode(String code) ;

    public String generateCode();

    /**
     * 查询新用户注册优惠券
     *
     * @return
     */
    public List<Coupon> queryRegister() ;

    public IPage<Coupon> querySelective(String name, Short type, Short status, Integer page, Integer limit) ;


    /**
     * 查询过期的优惠券:
     * 注意：如果timeType=0, 即基于领取时间有效期的优惠券，则优惠券不会过期
     *
     * @return
     */
    public List<Coupon> queryExpired();
}
